package jun.learn.thread.queue;

import java.util.concurrent.BlockingQueue;

public class Producer implements Runnable{
	private BlockingQueue<String> queue;
	
	public Producer(BlockingQueue<String> queue) {
		super();
		this.queue = queue;
	}

	public void run() {
		int i = 0;
		while(true){
			try {
				String value = String.valueOf(System.currentTimeMillis())+"++"+i++;
				queue.put(value);
				System.out.println(Thread.currentThread().getName()+"  Producer production:"+value);
				Thread.sleep(4000);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}
}
